@echo off
rd /q /s Universe.MediaProbe 1>nul 2>nul
svn checkout https://devizer.svn.codeplex.com/svn/trunk/Universe.MediaProbe
if errorlevel 1 goto err1
goto build
echo SVN checkout failed :(
goto end

:build
call Inc-Build.cmd
echo Version: "%MYVERSION%.%MYBUILD%"
title BUILD MediaProbe %MYVERSION%.%MYBUILD%
cd Universe.MediaProbe
rem rd /q /s Video2MP4\bin\Release
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild Universe.MediaProbe.sln  /t:Clean,Rebuild /p:Configuration=RELEASE

cd Universe.MediaProbe.Tests\bin\Release\
"C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe" Universe.MediaProbe.Tests.nunit /nologo
if ERRORLEVEL 1 goto fail
echo TEST SUCCSEED :)))
cd ..\..\..\Universe.MediaProbe\bin\Release
set outfolder=..\..\..\artifact\%MYVERSION%.%MYBUILD%
mkdir %outfolder% 1>nul 2>nul
xcopy /y *.* %outfolder%
goto end
:fail
echo TESTS FAILED :(
goto end
:end